Skip to content

packwiz: re-load LOAD_ENV_FROM_FILE after the installer runs#4137

Merged
itzg merged 2 commits into
itzg:masterfrom
ChipWolf:patch-1
Jun 26, 2026
Merged

packwiz: re-load LOAD_ENV_FROM_FILE after the installer runs#4137
itzg merged 2 commits into
itzg:masterfrom
ChipWolf:patch-1

Conversation

@ChipWolf

Copy link
Copy Markdown
Contributor

Fixes #4074.

When PACKWIZ_URL and LOAD_ENV_FROM_FILE are both set, the container sources the env file before packwiz writes it. start-configuration loads it during the configuration stage, before the deploy is dispatched. The packwiz installer runs later, in start-setupModpack, and writes pack files into /data, including any .env the pack ships. By that point the container has already sourced the previous file, or no file at all on a first run, so the pack's values never reach the rest of startup.

The fix re-runs loadEnvFromFile inside handlePackwiz once the installer succeeds, guarded on LOAD_ENV_FROM_FILE being set. start-setupModpack already sources start-utils, so the helper is in scope. The early load stays where it is, so TYPE and VERSION still resolve before the deploy is dispatched.

What changed:

  • scripts/start-setupModpack: re-load the env file after the packwiz installer runs.
  • docs/mods-and-plugins/packwiz.md: document the re-load, and note that TYPE and VERSION resolve earlier, so a pack .env can't set them (use LOAD_ENV_FROM_GENERIC_PACK or LOAD_ENV_FROM_ARCHIVE for that).

Behaviour only changes when both PACKWIZ_URL and LOAD_ENV_FROM_FILE are set. Existing setups behave the same.

To reproduce: serve a packwiz pack with a root .env (for example MOTD=from-packwiz), then run with EULA=TRUE TYPE=FABRIC PACKWIZ_URL=... LOAD_ENV_FROM_FILE=/data/.env on a clean /data. The resulting server.properties shows motd=from-packwiz; without this change it stays at the default. Updating the served .env and restarting picks up the new value.

@itzg itzg left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks!

@itzg itzg added the bug label Jun 26, 2026
@itzg itzg merged commit f1dd0f3 into itzg:master Jun 26, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LOAD_ENV_FROM_FILE loads .env before packwiz update

2 participants